﻿// MIT License
// 开源地址：https://gitee.com/co1024/AbcMvc
// Copyright (c) 2021-2023 1024
// Abc.Mvc=Furion+EF+SqlSugar+Pear layui admin.

namespace Abc.Core.Entities;

/// <summary>
/// 菜单
/// </summary>
[Comment("菜单")]
[SugarTable("Sys_Menu")]
public class SysMenu : FullEntityNoIdentity
{
    /// <summary>
    /// 菜单分组（API,后台）
    /// </summary>
    public MenuAreaType MenuAreaType { get; set; }

    /// <summary>
    /// 菜单ID，全局唯一标识
    /// </summary>
    [Comment("菜单ID")]
    [MaxLength(100)]
    public string Code { get; set; }

    /// <summary>
    /// 父Id
    /// </summary>
    [Comment("父Id")]
    [MaxLength(100)]
    public string PCode { get; set; }

    /// <summary>
    /// 区域
    /// </summary>
    [Comment("区域")]
    [MaxLength(100)]
    public string Area { get; set; }

    /// <summary>
    /// 菜单名称
    /// </summary>
    [Comment("菜单名称")]
    [MaxLength(100)]
    public string Name { get; set; }

    /// <summary>
    /// 是否可用
    /// </summary>
    [Comment("是否可用")]
    public bool IsEnable { get; set; }

    /// <summary>
    /// 图标
    /// </summary>
    [Comment("图标")]
    [MaxLength(200)]
    public string Icon { get; set; }

    /// <summary>
    /// 顺序(按从小到大排序)
    /// </summary>
    [Comment("顺序")]
    public int Sort { get; set; }

    /// <summary>
    /// Url(例如：HtAdmin/User/Index或https://www.baidu.com/xxxxx)
    /// </summary>
    [Comment("Url")]
    [MaxLength(500)]
    public string Url { get; set; }

    /// <summary>
    /// 控制器
    /// </summary>
    [Comment("控制器")]
    [MaxLength(100)]
    public string Controller { get; set; }

    /// <summary>
    ///  后台菜单页面名称(例如：index、info),API 接口可为空
    /// </summary>

    /// <summary>
    /// 方法/Action名称,多个用英文逗号隔开
    /// </summary>
    [Comment("方法/Action名称,多个用英文逗号隔开")]
    [MaxLength(300)]
    public string Actions { get; set; }

    /// <summary>
    /// 打开方式（字典 0 无， 1内链 2外链）
    /// </summary>
    public MenuOpenType OpenType { get; set; }

    /// <summary>
    ///备注
    /// </summary>
    [Comment("备注")]
    public string Remark { get; set; }

    /// <summary>
    /// 是否展开菜单
    /// </summary>
    [Comment("是否展开菜单")]
    public bool IsExpand { get; set; }

    /// <summary>
    /// 节点类型(菜单、工具栏)
    /// 目录 = 0, 菜单 = 1,API = 2,功能方法 = 3,
    /// </summary>
    [Comment("节点类型(菜单、工具栏)")]
    public MenuType MenuType { get; set; }

    /// <summary>
    /// 是否废止
    /// </summary>
    public bool IsDisuse { get; set; }

    /// <summary>
    /// 是否系统菜单,系统菜单禁止删除
    /// </summary>
    [Comment("是否系统菜单")]
    public bool IsSystem { get; set; }

    /// <summary>
    /// 是否显示菜单
    /// </summary>
    [Comment("是否显示")]
    public bool IsShow { get; set; }

    /// <summary>
    /// 是否自动生成
    /// 通过贴特性完成为自动生成 true
    /// 后台人工添加为 false
    /// </summary>
    [Comment("是否自动生成")]
    public bool IsAutoGeneration { get; set; }

    /// <summary>
    /// 是否控制器目录
    /// 注意：控制器目录不生成为后台菜单层次机构中去，不然多出来一层，要把这个换成菜单
    /// </summary>
    [Comment("是否控制器目录")]
    public bool IsControllerCatalogue { get; set; }

    #region ref

    ///// <summary>
    ///// 权限
    ///// </summary>
    //public ICollection<Permission> Permissions { get; set; }

    //[SugarColumn(IsIgnore = true)]
    //[Navigate(typeof(SysRoleMenu), nameof(SysRoleMenu.MenuId), nameof(SysRoleMenu.RoleId))]//注意顺序
    //public List<SysRole> Roles { get; set; }

    ///// <summary>
    ///// 角色功能
    ///// </summary>
    //[SugarColumn(IsIgnore = true)]
    //public List<SysRoleMenu> RoleMenus { get; set; }

    ///// <summary>
    ///// 菜单权限中间表
    ///// </summary>
    //public ICollection<MenuPermission> MenuPermissions { get; set; }

    //  public ICollection<Role> Roles { get; set; }

    #endregion ref
}